#!/usr/bin/python3.7

import json
import csv

cves_f=open('./transit/debianCVE.json',"r")
cves=json.load(cves_f)
cves_f.close()

nvd_f=open('./transit/NVDCVE.csv',"r")
f_csv = csv.reader(nvd_f)
data = list(f_csv)

resList =[]
for cve in cves:
	cve['cvss'] = "0"
	cve['score']= "0"
	cve['scope'] = "unknown"

	for row in data:
		if cve['cve'] == row[0]:
			cve['cvss'] = row[1]
			cve['score']= row[2]
			cve['scope'] = row[3]
			break
	#print(cve)
	resList.append(cve)

json_info = json.dumps(resList)
out_file=open("./output/CVE.json","w")
out_file.write(json_info)
out_file.close()
nvd_f.close()

